<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.js"></script>
</head>

<body>
  <div id="app">
    <ul>
      <li v-for="item in letters">{{item}}</li>
    </ul>
    <button @click="btnClick">按钮</button>
  </div>

  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        letters: ['a', 'b', 'c', 'd', 'e', 'f', 'g']
      },
      methods: {
        btnClick() {
          //  push方法
          // this.letters.push(Math.random())
          // 通过索引值修改数组元素
          // this.letters[0] = 'bbbb'
          // pop方法
          // this.letters.pop()
          // this.letters.shift()
          // this.letters.unshift(Math.random())
          // this.letters.splice(1, 2, 'a')
          
        }
      }
    })
  </script>
</body>

</html>